﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using EasyBuildingCMS.BLL.CoreEngine;

namespace EasyBuildingCMS.BuildingBlocks.ContentEdit
{
    public partial class ContentEditUserControl : System.Web.UI.UserControl
    {
        private string cssClass;
        public String CssClass
        {
            set { cssClass = value; }
            get { return cssClass; }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            
                int buildingBlockInstanceID = ((UserControlContainer)this.Parent).BuildingBlockInstanceID;
                EditableHTMLContentRepository editableHTMLContentRepository = new EditableHTMLContentRepository();
                EditableHTMLContent editableHTMLContent = editableHTMLContentRepository.GetHTMLContentByBuildingBlockInstanceID(buildingBlockInstanceID);
                if (editableHTMLContent != null)
                {
                    this.HTMLContentLiteral.Text = editableHTMLContent.HTMLContent;
                    if (!string.IsNullOrEmpty(editableHTMLContent.CssClass))
                    {
                        cssClass = editableHTMLContent.CssClass;
                    }
                }
       
        }
    }
}